package com.itheima.canal.listener;

import com.alibaba.otter.canal.protocol.CanalEntry;
import com.xpand.starter.canal.annotation.CanalEventListener;
import com.xpand.starter.canal.annotation.ListenPoint;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.annotation.Autowired;

@CanalEventListener//声明当前类是canal的监听类
public class RabbitListener {

    @Autowired
    private RabbitTemplate rabbitTemplate;

    @ListenPoint(schema = "changgou_business",table = "tb_ad")
    public void  update(CanalEntry.EventType eventType,CanalEntry.RowData rowData){

        rowData.getBeforeColumnsList().forEach(c-> System.out.println("更改之前的数据"+c.getName()+"::"+c.getValue()));

        rowData.getAfterColumnsList().forEach(c-> System.out.println("更改之后的数据"+c.getName()+"::"+c.getValue()));

    }



}
